class Solution {
    public:
        vector<int> path;
        vector<vector<int>> ret;
        int _k,_n;
        vector<vector<int>> combine(int n, int k) {
            _k=k;_n=n;
            dfs(1);
            return ret;
        }
        void dfs(int num){
            if(path.size() == _k){
                ret.push_back(path);
                return;
            }
            for(int i = num ; i <= _n ; i++){
                path.push_back(i);
                dfs(i+1);
                path.pop_back();
            }
        }
    };